package com.sunny.project;

import jdk.internal.util.xml.impl.Input;

import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * properties文件的读取工具
 * Created by joe on 16-8-1.
 */
public class PropertiesReader {

	public Map<String,String> getProperties(){

		Properties props = new Properties();
		Map<String,String> map = new HashMap<String,String>();

		try {
			InputStream in = getClass().getResourceAsStream("type.properties");
			props.load(in);
			Enumeration en = props.propertyNames();
			while(en.hasMoreElements()){
				String key = (String)en.nextElement();
				String properties = props.getProperty(key);//读取已"="为分割
				map.put(key,properties);
//				System.out.println(key+"  "+properties);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return map;
	}
}
